home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 1 / Macwelt DVD 1.toast / Web-Publishing / HTML-Editoren / Alpha ƒ / Tcl / Modes / Matlab mode / matlabMenu.tcl < prev    next >
Encoding:
Text File  |  1999-07-10  |  3.7 KB  |  129 lines

  1. ################################################################################
  2. #
  3. # matlabMenu.tcl, part of the matlab mode package
  4. # MATLAB menu definitions
  5. ################################################################################
  6.  
  7. proc matlabMenu.tcl {} {}
  8.  
  9. ################################################################################
  10. # Define the MATLAB menu
  11. ################################################################################
  12.  
  13. Menu -n $MATLMenu -M MATL -p matlabMenuItem {
  14.     "<O<U/MswitchToMatlab"
  15.     "<O<U/CcommandWindow"
  16.     "<O<U/HcommandHistory"
  17.     "(-"
  18.     "<O<U/OeditInMatlab"
  19.     "<O<U/SexecuteSelection"
  20.     "<O<U/EsaveAndExecute"
  21.     "<O<U/DopenSelection"
  22.     "(-"
  23.     {Menu -n commandHelp -M MATL -p matlabMenuItem {
  24.         "<O<U//normalHelp"
  25.         "<O<U<I/DhelpSelection"
  26.         "<O<U/tsearchDocumentation"
  27.         "makeDocumentation"
  28.     }}
  29.     {Menu -n workspace -M MATL -p matlabMenuItem {
  30.         "<O<U/PrebuildPath"
  31.         "addToPath"
  32.         "cdToWin"
  33.         "<O<U/KclearWorkspace"
  34.         "<O<U<I/KclearProcedure"
  35.         "<O<U/FcloseAll"
  36.         "clearEventQue"
  37.     }}
  38.     {Menu -n debug -M MATL -p matlabMenuItem {
  39.         "debugInMatlab"
  40.         "<O<U/BstopIfError"
  41.         "stopInFile"
  42.         "stopAtCurrentLine"
  43.         "<B<I/SstepOneLine"
  44.         "clearAllBreakpoints"
  45.         "fileBreakpoints"
  46.         "<O<U/GopenErrorFile"
  47.     }}
  48.     {Menu -n quickOptions -M MATL -p matlabMenuItem {
  49.         "clearOnSave"
  50.         "webHelp"
  51.     }}
  52. }
  53.  
  54. ################################################################################
  55. # Mark the quickOptions
  56. ################################################################################
  57.  
  58. markMenuItem quickOptions clearOnSave $MATLmodeVars(clearOnSave)
  59. markMenuItem quickOptions webHelp $MATLmodeVars(webHelp)
  60.  
  61. ################################################################################
  62. # Call Menu item procs
  63. ################################################################################
  64.  
  65. proc matlabMenuItem {menu item} {
  66.     global MATLMenu
  67.     switch -- $menu $MATLMenu {
  68.         switch -- $item {
  69.             switchToMatlab     {matlab}
  70.             commandWindow      {matlabCmdWindow}
  71.             commandHistory     {matlabCmdHistWindow}
  72.             editInMatlab       {editInMatlab}
  73.             saveAndExecute     {matlabSaveAndExecute}
  74.             executeSelection   {matlabDoSelectionOrLine}
  75.             openSelection      {matlabOpenSelection}
  76.             default            {catch {matDummyMenuItem $menu $item}}
  77.         }
  78.     } workspace {
  79.         switch -- $item {
  80.             rebuildPath        {matlabRebuildPath}
  81.             clearWorkspace     {matlabClear}
  82.             clearProcedure     {matlabClearProcedure}
  83.             closeAll           {matlabCloseAll}
  84.             addToPath          {matlabAddToPath}
  85.             cdToWin            {matlabCdToWin}
  86.             clearEventQue      {MATL::clearEventQue}
  87.         }
  88.     } commandHelp {
  89.         switch -- $item {
  90.             normalHelp            {matlabHelp}
  91.             searchDocumentation   {matlabSearchHelpDialog}
  92.             helpSelection         {matlabHelpSelection}
  93.             makeDocumentation     {makeMatlabHTML}
  94.         }
  95.     } debug {
  96.         switch -- $item {
  97.             debugInMatlab        {debugInMatlab}
  98.             stopIfError          {matlabStopIfError}
  99.             stopInFile           {matlabStopInFile}
  100.             stopAtCurrentLine    {matlabStopAtCurrentLine}
  101.             stepOneLine          {matlabDebugStep}
  102.             clearAllBreakpoints  {matlabDbClear}
  103.             fileBreakpoints      {matlabDebugStatus}
  104.             openErrorFile        {matlabOpenErrorFile}
  105.         }
  106.     } quickOptions {
  107.         switch -- $item {
  108.             clearOnSave       {matlabMenuSwap clearOnSave}
  109.             webHelp           {matlabMenuSwap webHelp}
  110.         }
  111.     }
  112. }
  113.  
  114.  
  115. ################################################################################
  116. # Change quickOptions
  117. ################################################################################
  118.  
  119. proc matlabMenuSwap {item} {
  120.    global MATLmodeVars modifiedModeVars
  121.  
  122.    set MATLmodeVars($item) [expr ! $MATLmodeVars($item)]
  123.    lappend modifiedModeVars [list $item MATLmodeVars]
  124.    markMenuItem quickOptions $item $MATLmodeVars($item)
  125. }
  126.  
  127.